<?php
namespace Home\Model;
use  Think\Model;
class RegionBaseModel extends Model{

    protected $autoCheckFields =false;
    /**
     * 获得指定国家的所有省份
     * @param type $type
     * @param type $parent
     * @return type
     */
    public function get_regions($type = 0, $parent = 0) {
        $condition['region_type'] = $type;
        $condition['parent_id'] = $parent;
       
        $region=M('region');
        $field='region_id,region_name';
        $list=$region->field($field)->where($condition)->order('CONVERT(region_name USING gbk) ')->select();

        return $list;
    }

    public function get_region_name($region_id)
    {
         $where['region_id']=$region_id;
         return M('region')->where($where)->getField('region_name');
    }

}
?>
